package org.serviceImpl;

import org.dao.HistoryDao;
import org.dao.WikiDao;
import org.model.History;
import org.model.Wiki;
import org.service.WikiService;

import java.util.List;

/**
 * Created by tedzy on 2015/5/18.
 * Wiki Service Impl
 */
public class WikiServiceImpl implements WikiService {
    private WikiDao wikiDao;
    private HistoryDao historyDao;

    @Override
    public int newWiki(String title, String content) {
        return wikiDao.newWiki(title, content);
    }

    @Override
    public int newHistory(int wikiid, int uid, String title, String content, String reason) {
        return historyDao.newHistory(wikiid, uid, title, content, reason);
    }

    @Override
    public boolean editWiki(int id, String title, String content) {
        return wikiDao.editWiki(id, title, content);
    }

    @Override
    public Wiki getWiki(String title) {
        return wikiDao.getWiki(title);
    }

    @Override
    public List<Wiki> searchWiki(String title) {
        return wikiDao.searchWiki(title);
    }

    @Override
    public List<History> getHistories(int wikiid) {
        return historyDao.getHistories(wikiid);
    }

    @Override
    public Wiki getWikiById(int wikiid) {
        return wikiDao.getWikiById(wikiid);
    }

    @Override
    public History getHistory(int id) {
        return historyDao.getHistory(id);
    }

    @Override
    public List<History> getAuthorHistories(int uid) {
        return historyDao.getAuthorHistories(uid);
    }

    public WikiDao getWikiDao() {
        return wikiDao;
    }

    public void setWikiDao(WikiDao wikiDao) {
        this.wikiDao = wikiDao;
    }

    public HistoryDao getHistoryDao() {
        return historyDao;
    }

    public void setHistoryDao(HistoryDao historyDao) {
        this.historyDao = historyDao;
    }
}
